using System.Collections;
using System.Collections.Generic;
using TinyTeam.UI;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;

public class Top_BoxUI : TTUIPage
{
    private Image bg;
    private Text BiaoTi;
    private Text NeiRong;
    private Button OK_Btn;
    private Text Text;
    public Top_BoxUI() : base(UIType.PopUp, UIMode.DoNothing, UICollider.None)
    {
        uiPath = "UI/Top_BoxUI";
    }

    public override void Awake(GameObject go)
    {
        BiaoTi = go.transform.Find("bg/BiaoTi").GetComponent<Text>();
        NeiRong = go.transform.Find("bg/NeiRong").GetComponent<Text>();
        OK_Btn = go.transform.Find("bg/OK_Btn").GetComponent<Button>();
        
    }
    public override void Refresh()
    {
        TopBoxData top = (TopBoxData)data;
        BiaoTi.text = top.title;
        NeiRong.text = top.content;
        OK_Btn.onClick.RemoveAllListeners();
        if (top.cb != null)
        {
            OK_Btn.onClick.AddListener(()=> { top.cb.Invoke();TTUIPage.ClosePage<Top_BoxUI>(); });
        }
    }

    

}
